ifneq ($(KERNELRELEASE),)

$(info "start compile driver...")

obj-m := hello_world.o
#$(TARGET)-y = hello_world.o
$(info "compile driver end")

else

$(info "start prepare...")

CC_PREFIX=/home/wk/gpu/loongson_jari_crosscompiler/cross-gcc-4.9.3-n64-loongson-rc6.1

export LD_LIBRARY_PATH:=${CC_PREFIX}/usr/lib:${CC_PREFIX}/usr/x86_64-unknown-linux-gnu/mips64el-loongson-linux/lib:${LD_LIBRARY_PATH}
KERNEL_DIR=/home/wk/gpu/loongson_jari_rootfs/lib/modules/3.10.0-rt56-210106+/build

CROSS_COMPILE=/home/wk/gpu/loongson_jari_crosscompiler/cross-gcc-4.9.3-n64-loongson-rc6.1/usr/bin/mips64el-loongson-linux-

CUR_DIR = $(shell pwd)
$(info CUR_DIR=$(CUR_DIR))

CFLAGS = -Wno-error=date-time -Wno-date-time

all:
	make V=1 -C $(KERNEL_DIR) M=$(CUR_DIR) modules  ARCH=mips CROSS_COMPILE=$(CROSS_COMPILE)  $(CFLAGS)  

clean:
	make -C $(KERNEL_DIR) M=$(CUR_DIR) clean

endif
